﻿using Custom.Infrastructure;
using Custom.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Custom.Service.Repository
{
    public class CustomInfoRepository : DbContext<CustomInfo>
    {
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids"></param>
        public void BatchDelete(List<int> ids)
        {
            Db.Ado.BeginTran();

            try
            {
                foreach (int id in ids)
                {
                    string sql = "delete from custominfo where id = @id";

                    Db.Ado.ExecuteCommand(sql, new { id = id });
                }
                Db.Ado.CommitTran();
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
            }
        }
    }
}
